package com.ywjt.platformbusiness.market.commongoods.adapter;


import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.market.commongoods.model.GoodsDetail;

import java.util.List;

public class BottomCouponAdapter extends BaseQuickAdapter<GoodsDetail.ResultDTO.DiscountCouponListDTO, BaseViewHolder> {
    private Integer status=0;

    public BottomCouponAdapter(List<GoodsDetail.ResultDTO.DiscountCouponListDTO> data, Integer status) {
        super(R.layout.item_coupon, data);
        this.status=status;
    }

    @Override
    protected void convert(BaseViewHolder helper,GoodsDetail.ResultDTO.DiscountCouponListDTO item) {
        LinearLayout llContainer=helper.getView(R.id.llContainer);
        TextView tvPick=helper.getView(R.id.tvPick);
        TextView tvMoney=helper.getView(R.id.tvMoney);
        TextView tvIntro=helper.getView(R.id.tvIntro);
        TextView tvOverDueTime=helper.getView(R.id.tvOverDueTime);

        tvMoney.setText(item.getDiscountAmount()+"");
        tvIntro.setText("满"+item.getReachAmount()+"元减"+item.getDiscountAmount()
        +"元");
        tvOverDueTime.setText("有效期至："+item.getEndTime());

        if (item.getIsReceive()==0){//0未领取 1已领取
            llContainer.setBackgroundResource(R.mipmap.icon_coupon_pink_bg);
            tvPick.setTextColor(mContext.getResources().getColor(R.color.red));
            tvMoney.setTextColor(mContext.getResources().getColor(R.color.red));
            tvIntro.setTextColor(mContext.getResources().getColor(R.color.red));
            tvOverDueTime.setTextColor(mContext.getResources().getColor(R.color.red));
        }else {
            llContainer.setBackgroundResource(R.mipmap.icon_coupon_gray_bg);
            tvPick.setTextColor(mContext.getResources().getColor(R.color.white));
            tvMoney.setTextColor(mContext.getResources().getColor(R.color.white));
            tvIntro.setTextColor(mContext.getResources().getColor(R.color.white));
            tvOverDueTime.setTextColor(mContext.getResources().getColor(R.color.white));
        }
    }
}
